function withResizable(WrappedComponent) {
    function WithResizable() {
        const [sizes, setSizes] = useState([window.innerWidth, window.innerHeight])
        useEffect(() => {
            window.addEventListener("resize", () => {
                setSizes([window.innerWidth, window.innerHeight])
            })
        }, [])
        return <WrappedComponent sizes={sizes} />
    }

    return WithResizable
}

function App({ sizes }) {
    return <div>{JSON.stringify(sizes)}</div>
}

export default withResizable(App);
